{template 'header'}
<style>
    .yongjins {
        padding: 0 0.75rem 0.75rem;
        background: #F4F4F4;
    }

    .yongjins p {
        margin-bottom: 0;
        font-size: 14px;
    }

    .yongjin_title {
        width: 100%;
        height: 40px;
        line-height: 40px;
        margin-top: 15px;
    }

    .yongjins b {
        color: #f00;
    }

    .bitian {
        color: #999;
        font-size: 1rem;
        line-height: 1.4rem;
    }

    .mui-input-group .mui-input-row:after {
        left: 0;
    }
    .mui-btn-block{
        margin: 15px auto;
        padding: 11px 0;
        width: 96%;
        font-size: 14px;
    }
    #input_example,#input_example input{
        font-size: 14px;
    }
</style>
</head>
<body>
<div class="mui-content">
    <div class="yongjins">
        <p class="yongjin_title">我的佣金：<b id="">{$user['user_money']}</b></p>
        <p class="bitian">为确保您申请的金额能够正确无误的转入您账户，请填写真实有效的信息，以下信息均为必填项！说明：</p>
        <p>1、费率：提现单次100元，手续费为{$task_param_setting['tx_fee']}元;</p>
        <p>2、单次最小提现金额为{$task_param_setting['tx_min']}元。</p>
        <p>如有失误，概不负责。</p>
    </div>
    <div class="mui-input-group" id="input_example">
        <div class="mui-input-row">
            <label>提现金额</label>
            <input type="text" class="mui-input-clear" placeholder="请输入提现金额" value=""
                   onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" id="money">
        </div>
        <div class="mui-input-row">
            <label>支付宝姓名</label>
            <input type="text" class="mui-input-clear" value="{$user['alipay_name']}" placeholder="请输入支付宝姓名" id="alipay_name">
        </div>
        <div class="mui-input-row">
            <label>支付宝账号</label>
            <input type="text" class="mui-input-clear" value="{$user['alipay_account']}" placeholder="请输入支付宝账号" id="alipay_account">
        </div>
    </div>
    <button type="button" class="mui-btn mui-btn-primary mui-btn-block" onclick="sub_btn()">确认</button>
</div>
<script src="{MODULE_URL}assets/js/mui.min.js"></script>
<script src="{MODULE_URL}assets/js/jquery.min.js"></script>
<script type="text/javascript">
    mui.init({})
    mui.ready(function () {
    });
    //点击提交的按钮
    function sub_btn() {
        var check = true;
        mui("#input_example input").each(function () {
            //若当前input为空，则alert提醒
            if (!this.value || this.value.trim() == "") {
                var label = this.previousElementSibling;
                mui.alert(label.innerText + "不允许为空");
                check = false;
                return false;
            }
        });
        //校验通过，继续执行业务逻辑
        if (check == true) {
            var rob_url = '{php echo $this->createMobileUrl("core",array("op"=>"cashout"))}';
            var money = $('#money').val()
            var alipay_name = $('#alipay_name').val()
            var alipay_account = $('#alipay_account').val()
            mui.ajax(rob_url,{
                data:{money,alipay_name,alipay_account},
                dataType:'json',//服务器返回json格式数据
                type:'post',//HTTP请求类型
                async: false,
                timeout:10000,//超时时间设置为10秒；
                success:function(ret){
                    if(ret.code==10001){
                        mui.toast(ret.msg)
                        location.href = '{php echo $this->createMobileUrl("public",array("op"=>"login"))}'
                    }else if(ret.code==0){
                        mui.toast(ret.msg)
                    }else{
                        mui.alert(ret.msg,'',function(){
                            location.href = '{php echo $this->createMobileUrl("member",array("op"=>"index"))}'
                        })
                    }
                },
                error:function(xhr,type,errorThrown){
                    //异常处理；
                    mui.alert(errorThrown);
                }
            });
        }else{
            mui.toast('请输入正确的提现信息');
        }
    }
</script>
</body>

</html>